< previous page page_143 next page >

Page 143
Next you need to update the ReadProperties and WriteProperties events of the UserControl. Listing 5.26 has the modified ReadProperties event. Refer to Listing 5.27 for the most recent changes to the WriteProperties event.
Type.gifListing 5.26. Modifying the ReadProperties event.
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
    '
    ' read design-time property values
    '
    With PropBag
        m_UpperCase = .ReadProperty("UpperCase", m_def_UpperCase)
        m_Digits = .ReadProperty("Digits", m_def_Digits)
        m_Numeric = .ReadProperty("Numeric", m_def_Numeric)
        '
        m_CheckRange = .ReadProperty("CheckRange", m_def_CheckRange)
        m_LowValue = .ReadProperty("LowValue", m_def_LowValue)
        m_HighValue = .ReadProperty("HighValue", m_def_HighValue)
        '
        Text1.Text = .ReadProperty("Text", UserControl.Name)
    End With
    '
End Sub
Type.gifListing 5.27. Modifying the WriteProperties event.
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
    '
    ' save design-time property values
    '
    With PropBag
        Call .WriteProperty("UpperCase", m_UpperCase, m_def_UpperCase)
        Call .WriteProperty("Digits", m_Digits, m_def_Digits)
        Call .WriteProperty("Numeric", m_Numeric, m_def_Numeric)
        '
        Call .WriteProperty("CheckRange", m_CheckRange, m_def_CheckRange)
        Call .WriteProperty("LowValue", m_LowValue, m_def_LowValue)
        Call .WriteProperty("HighValue", m_HighValue, m_def_HighValue)
        '
        Call .WriteProperty("Text", Text1.Text, UserControl.Name)
    End With
    '
End Sub
Now you need to write the actual range validation routine. Use the Tools | Add Procedure dialog to create a method called InRangeValidate with the Sub and Public options. Add the code from Listing 5.28 to the method.

 
< previous page page_143 next page >

If you like this book, buy it!